package com.springboot.cms.broadside.service.impl;

import com.springboot.cms.broadside.domain.CmsBroadside;
import com.springboot.cms.broadside.mapper.CmsBroadsideMapper;
import com.springboot.cms.broadside.service.ICmsBroadsideService;
import com.springboot.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 侧边栏管理Service业务层处理
 *
 * @author lhxz
 * @date 2024-07-08
 */
@Service
public class CmsBroadsideServiceImpl implements ICmsBroadsideService
{
    @Autowired
    private CmsBroadsideMapper cmsBroadsideMapper;

    /**
     * 查询侧边栏管理
     *
     * @param id 侧边栏管理主键
     * @return 侧边栏管理
     */
    @Override
    public CmsBroadside selectCmsBroadsideById(Long id)
    {
        return cmsBroadsideMapper.selectCmsBroadsideById(id);
    }

    /**
     * 查询侧边栏管理列表
     *
     * @param cmsBroadside 侧边栏管理
     * @return 侧边栏管理
     */
    @Override
    public List<CmsBroadside> selectCmsBroadsideList(CmsBroadside cmsBroadside)
    {
        return cmsBroadsideMapper.selectCmsBroadsideList(cmsBroadside);
    }

    /**
     * 新增侧边栏管理
     *
     * @param cmsBroadside 侧边栏管理
     * @return 结果
     */
    @Override
    public int insertCmsBroadside(CmsBroadside cmsBroadside)
    {
        cmsBroadside.setCreateTime(DateUtils.getNowDate());
        return cmsBroadsideMapper.insertCmsBroadside(cmsBroadside);
    }

    /**
     * 修改侧边栏管理
     *
     * @param cmsBroadside 侧边栏管理
     * @return 结果
     */
    @Override
    public int updateCmsBroadside(CmsBroadside cmsBroadside)
    {
        cmsBroadside.setUpdateTime(DateUtils.getNowDate());
        return cmsBroadsideMapper.updateCmsBroadside(cmsBroadside);
    }

    /**
     * 批量删除侧边栏管理
     *
     * @param ids 需要删除的侧边栏管理主键
     * @return 结果
     */
    @Override
    public int deleteCmsBroadsideByIds(Long[] ids)
    {
        return cmsBroadsideMapper.deleteCmsBroadsideByIds(ids);
    }

    /**
     * 删除侧边栏管理信息
     *
     * @param id 侧边栏管理主键
     * @return 结果
     */
    @Override
    public int deleteCmsBroadsideById(Long id)
    {
        return cmsBroadsideMapper.deleteCmsBroadsideById(id);
    }
}
